<template>
  <div class="fxhome">
      <div class="fxavt">
              <div class="navt"><img :src="$store.state.agent.head_img" alt=""> </div>
              <div class="nname"> {{$store.state.agent.real_name ? $store.state.agent.real_name:$store.state.agent.nickname}} </div>
      </div>
    <div class="fxinfo">
      <div  @click="$router.push({name:'agent_list'})">
        <div class="fxinfo_linea"> {{$store.state.agent.underAgent?$store.state.agent.underAgent:0}} </div>
        <div class="fxinfo_lineb"> 下级代理总数 </div>
      </div>
      <div >
        <div class="fxinfo_linea"> {{$store.state.agent.fxfee}} </div>
        <div class="fxinfo_lineb"> 可提现佣金 </div>
      </div>
    </div>

    <div class="funcs">
      <div class="fs_title">

      </div>
      <div class="fs_item">
        <div class="sec" @click="$router.push({name:'agent_add'})">
          <div class="ico ">
            <div class="iconfont icon-gerenzhongxin"></div>
          </div>
          <div class="sec_txt">添加代理</div>
        </div>
        <div class="sec" @click="$router.push({name:'agent_order'})">
          <div class="ico ">
            <div class="iconfont icon-icon-"></div>
          </div>
          <div class="sec_txt">手动下单</div>
        </div>
        <div class="sec" @click="$router.push({name:'agent_withdraw'})">
          <div class="ico ">
            <div class="iconfont icon-tixian"></div>
          </div>
          <div class="sec_txt">提现</div>
        </div>
        <div class="sec">
          <div class="ico">
            <div class="iconfont icon-c"></div>
          </div>
          <div class="sec_txt">设置</div>
        </div>
      </div>
    </div>

    <div class="fother">
      <div class="fft"> 我的二维码 </div>
      <div class="fqrcode">
        <qrcode :value="nurl" :options="{size:120}" style="width: 100%;margin:0 auto"></qrcode>
      </div>
    </div>

  </div>
</template>

<script>
export default {
  name: 'home',
  data () {
    return {
      nurl: 'abc'
    }
  },
  created: async function () {
    if (this.$route.query.agent_oid) {
      window.localStorage.setItem('agent_oid', this.$route.query.agent_oid)
    } else {
      let oid = window.localStorage.getItem('agent_oid')
      if (!oid) {
        this.$router.push({name: 'agent_login'})
      }
    }
  },
  beforeMount: async function () {
    let oid = window.localStorage.getItem('agent_oid');
    this.nurl = `http://tmc.guotaijinxing.com/wx/entrytmc?relId=` + oid
  },
  mounted: async function () {
    setTimeout(() => { this.$store.commit('updateAgent') }, 500)
  }
}
</script>

<style scoped>
  .br{
    border:1px solid red
  }
  .fxhome{
    height: 100%;
    color:#444
  }

  .fxavt{
    height: 150px;
    padding-top: 25px;
    box-sizing: border-box;

  }
  .fxinfo{

    display: flex;
  }
  .fxinfo > div:first-child{
    border-right: 1px solid #e9e9e9;
  }

  .ico > div{
    text-align: center;
    line-height: 25px;
    font-size: 23px;
  }
  .fxinfo > div{
    width: 0;
    flex-grow: 1;
    text-align: center;
  }
  .fxinfo_linea{
    font-size: 25px;
    line-height: 1.5;
  }
  .fxinfo_lineb{
    font-size:14px ;
    line-height: 2;
  }
  .fs_title{
    line-height: 30px;
    font-size: 14px;
    height: 30px;
  }
  .fs_item{
    display: flex;
    box-shadow: 2px 2px 25px rgba(0,0,0,.1);
    padding:5px 5px 8px
  }
  .sec{
    width: 0;
    flex-grow: 1;
  }
  .sec .ico{
    width: 25px;
    height: 25px;
    margin: 10px auto 5px;
  }
  .sec_txt{
    text-align: center;
    font-size: 12px;
  }

  .fother{
    width: 50vw;
    padding-top: 20px;
    margin: 0 auto;
  }
  .fft{
    font-size: 14px;
    text-align: center;
    line-height: 2;
  }
  .fqrcode{
    width: 35vw;
    height: 35vw;
    margin: 0 auto;
  }
  .navt{
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 50%;
    margin: 0 auto;
  }
  .navt > img{
    width: 100%;
  }
  .nname{
    line-height: 2;
    font-size: 14px;
    text-align: center;

  }

</style>
